﻿using BillMgr.Utils;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BillMgr.Service
{
    public static class loginServicecs
    {
        public static int addUser(String userId, String userName)
        {
            MYSQLHelperTrans mySQLHelperTrans = new MYSQLHelperTrans();
            try
            {
                MySqlParameter[] parameter = { 
                                             new MySqlParameter("@ID",MySqlDbType.Int32),
                                             new MySqlParameter("@Name",MySqlDbType.String)
                                         };
                parameter[0].Value = userId;
                parameter[1].Value = userName;
                mySQLHelperTrans.ExecuteSqlTran(DbScript.GetHashTable("USERNAME"), parameter);
                mySQLHelperTrans.Commit();
                return 0;
            }
            catch (Exception ex)
            {
                mySQLHelperTrans.RollBack();
                throw ex;
            }
        }
    }
}
